package com.aspose.cells;

import java.util.HashMap;
import java.util.Iterator;

class zbur {
   static boolean a(Validation var0, Worksheet var1, Cell var2) {
      return a(var0, var1, var2, var2.getRow(), var2.getColumn());
   }

   static boolean a(Validation var0, Worksheet var1, Cell var2, int var3, int var4) {
      if (var0.getType() == 0) {
         return true;
      } else {
         byte var5 = 0;
         byte var6 = 0;
         int[] var7 = new int[]{var6};
         int[] var8 = new int[]{var5};
         var0.a(var7, var8);
         int var23 = var7[0];
         int var22 = var8[0];
         if (var0.b == null) {
            return true;
         } else {
            Cells var9 = var1.getCells();
            if (var2 == null) {
               var2 = var9.checkCell(var3, var4);
            }

            Object var10 = null;
            if (var2 == null) {
               var10 = null;
            } else {
               var10 = var2.getValue();
            }

            if (var10 == null) {
               return var0.getIgnoreBlank();
            } else {
               zyh var11 = null;
               Object var12 = null;
               zabd var13 = null;
               switch(var0.getType()) {
               case 3:
                  var11 = new zyh(var1.c().n());
                  var11.a(true, true);
                  return a(var0, var1, var3, var4, var10, var9, var2, var11);
               case 7:
                  var11 = new zyh(var1.c().n());
                  var11.a(true, false);
                  var13 = var1.c().x().a(var2, var0.b, 0);
                  var12 = var11.b(var13, var2);
                  if (var12 instanceof Boolean) {
                     return (Boolean)var12;
                  }

                  return true;
               default:
                  double var14 = 0.0D;
                  if (var0.getType() == 6) {
                     var14 = (double)var2.getStringValue().length();
                  } else {
                     label95:
                     switch(var2.getType()) {
                     case 1:
                     case 4:
                        var14 = var2.getDoubleValue();
                        switch(var0.getType()) {
                        case 1:
                           if (!zbc.a(var14, (double)((int)var14))) {
                              return false;
                           }
                        case 2:
                        case 3:
                        default:
                           break label95;
                        case 4:
                           if (var14 < 0.0D) {
                              return false;
                           }
                           break label95;
                        case 5:
                           if (var14 < 0.0D || var14 >= 1.0D) {
                              return false;
                           }
                           break label95;
                        }
                     default:
                        return false;
                     }
                  }

                  var11 = new zyh(var1.c().n());
                  var11.a(true, false);
                  var13 = var1.c().x().a(var2, var0.b, 0);
                  var12 = var11.b(var13, var2);
                  Object var16 = null;
                  if (var0.getOperator() == 0 || var0.getOperator() == 7) {
                     zabd var17 = var1.c().x().a(var2, var0.c, 0);
                     var16 = var11.b(var17, var2);
                  }

                  double var24 = 0.0D;
                  double var19 = 0.0D;
                  switch(var0.getType()) {
                  case 1:
                  case 2:
                  case 4:
                  case 5:
                  case 6:
                     Object var21 = zyn.a(var12, var1.getWorkbook().getSettings());
                     if (!(var21 instanceof Double)) {
                        return true;
                     }

                     var24 = (Double)var21;
                     if (var16 != null) {
                        var21 = zyn.a(var16, var1.getWorkbook().getSettings());
                        if (!(var21 instanceof Double)) {
                           return true;
                        }

                        var19 = (Double)var21;
                     }
                  case 3:
                  }

                  boolean var25 = zbc.a(var14, var24);
                  switch(var0.getOperator()) {
                  case 0:
                     return var14 >= var24 && var14 <= var19;
                  case 1:
                     return var25;
                  case 2:
                     return !var25 && var14 > var24;
                  case 3:
                     return var25 || var14 > var24;
                  case 4:
                     return !var25 && var14 < var24;
                  case 5:
                     return var25 || var14 < var24;
                  case 6:
                  default:
                     return true;
                  case 7:
                     return var14 < var24 && var14 > var19;
                  case 8:
                     return !var25;
                  }
               }
            }
         }
      }
   }

   static Object[] a(Validation var0, WorksheetCollection var1, Cell var2) {
      zabd var4;
      if (!var0.getFormula1().startsWith("=")) {
         String var17 = var0.getFormula1();
         var4 = null;
         String[] var18;
         if (var17.indexOf(44) != -1) {
            var18 = com.aspose.cells.b.a.zv.d(var17, ',');
         } else {
            var18 = new String[]{var17};
         }

         Object[] var19 = new Object[var18.length];

         for(int var21 = 0; var21 < var19.length; ++var21) {
            var19[var21] = var18[var21];
         }

         return var19;
      } else {
         zyh var3 = new zyh(var1.n());
         var3.a(true, true);
         var4 = var1.x().a(var2, var0.b, 0);
         Object var5 = var3.b(var4, var2);
         int var8;
         int var10;
         int var11;
         if (var5 instanceof zft) {
            zft var6 = (zft)var5;
            int[] var7 = new int[]{var1.q().b(var6.a, var6.b), var6.d.StartRow, var6.d.StartColumn, var6.d.EndRow, var6.d.EndColumn};
            var8 = var7[0];
            int var9 = var7[1];
            var10 = var7[2];
            var11 = var7[3];
            int var12 = var7[4];
            if (var12 < var10) {
               int var13 = var10;
               var10 = var12;
               var12 = var13;
            }

            int var14 = var1.q().c(var8);
            if (var14 != var1.u()) {
               return null;
            }

            int var15 = var1.q().d(var8);
            if (var15 < 0 || var15 > var1.getCount()) {
               return null;
            }

            Cells var16 = var1.get(var15).getCells();
            Range var26 = var16.createRange(var9, var10, var11 - var9 + 1, var12 - var10 + 1);
            var5 = var26.getValue();
         }

         if (!(var5 instanceof Object[][])) {
            return new Object[]{var5};
         } else {
            Object[][] var20 = (Object[][])((Object[][])var5);
            int var22 = var20.length;
            var8 = var20[0].length;
            HashMap var23 = new HashMap();

            for(var10 = 0; var10 < var22; ++var10) {
               if (var20[var10] != null) {
                  for(var11 = 0; var11 < var8; ++var11) {
                     if (var20[var10][var11] != null) {
                        var23.put(var20[var10][var11], var20[var10][var11]);
                     }
                  }
               }
            }

            Object[] var24 = new Object[var23.size()];
            var11 = 0;

            Object var27;
            for(Iterator var25 = var23.values().iterator(); var25.hasNext(); var24[var11++] = var27) {
               var27 = var25.next();
            }

            return var24;
         }
      }
   }

   private static boolean a(Validation var0, Worksheet var1, int var2, int var3, Object var4, Cells var5, Cell var6, zyh var7) {
      if (var4 == null) {
         return false;
      } else {
         String var8 = var6.getStringValue();
         double var9 = 0.0D;
         int var11 = var6.m();
         switch(var11) {
         case 1:
         case 4:
            var9 = var6.getDoubleValue();
         default:
            if (!var0.getFormula1().startsWith("=")) {
               return a(var8, var0.getFormula1());
            } else {
               zabd var12 = var1.c().x().a(var6, var0.b, 0);
               Object var13 = var7.b(var12, (Cell)null);
               int var16;
               int var17;
               int var18;
               if (var13 instanceof zft) {
                  zft var14 = (zft)var13;
                  int[] var15 = new int[]{var1.c().q().b(var14.a, var14.b), var14.d.StartRow, var14.d.StartColumn, var14.d.EndRow, var14.d.EndColumn};
                  var16 = var15[0];
                  var17 = var15[1];
                  var18 = var15[2];
                  int var19 = var15[3];
                  int var20 = var15[4];
                  if (var20 < var18) {
                     int var21 = var18;
                     var18 = var20;
                     var20 = var21;
                  }

                  int var22 = var1.c().q().c(var16);
                  if (var22 != var1.c().u()) {
                     return true;
                  }

                  int var23 = var1.c().q().d(var16);
                  if (var23 < 0 || var23 > var1.c().getCount()) {
                     return true;
                  }

                  var5 = var1.c().get(var23).getCells();
                  Range var28 = var5.createRange(var17, var18, var19 - var17 + 1, var20 - var18 + 1);
                  var13 = var28.getValue();
               }

               if (!(var13 instanceof Object[][])) {
                  if (var13 instanceof String) {
                     return a(var8, (String)var13);
                  } else {
                     Object var25 = zmc.a((Object)var8, (Object)var13, "=", var1.getWorkbook().getSettings().getDate1904());
                     return var25 instanceof Boolean ? (Boolean)var25 : true;
                  }
               } else {
                  Object[][] var24 = (Object[][])((Object[][])var13);
                  int var26 = var24.length;
                  var16 = var24[0].length;

                  for(var17 = 0; var17 < var26; ++var17) {
                     if (var24[var17] != null) {
                        for(var18 = 0; var18 < var16; ++var18) {
                           Object var27 = null;
                           switch(var11) {
                           case 1:
                           case 4:
                              var27 = zmc.a((Object)var9, (Object)var24[var17][var18], "=", var1.getWorkbook().getSettings().getDate1904());
                              break;
                           default:
                              var27 = zmc.a((Object)var8, (Object)var24[var17][var18], "=", var1.getWorkbook().getSettings().getDate1904());
                           }

                           if (var27 instanceof Boolean && (Boolean)var27) {
                              return true;
                           }
                        }
                     }
                  }

                  return false;
               }
            }
         }
      }
   }

   static boolean a(String var0, String var1) {
      String[] var2 = null;
      if (var1.indexOf(44) != -1) {
         var2 = com.aspose.cells.b.a.zv.d(var1, ',');
      } else {
         var2 = new String[]{var1};
      }

      for(int var3 = 0; var3 < var2.length; ++var3) {
         if (com.aspose.cells.b.a.zv.a(var2[var3], var0, true) == 0) {
            return true;
         }
      }

      return false;
   }
}
